﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Style x:Key="DatePickerCalendarStyle" TargetType="{x:Type Calendar}" BasedOn="{StaticResource {x:Type Calendar}}" />
	<!--The template for the button that displays the calendar.-->
	<Style x:Key="DropDownButtonStyle" TargetType="Button">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Border x:Name="PART_Border" Background="Transparent" BorderThickness="1,0,0,0"
							BorderBrush="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
							Width="23">
						<Image Source="pack://application:,,,/Daytimer.Images;component/Images/newappointment_sml.png"
								Stretch="None" Height="16" Width="16" VerticalAlignment="Center"
								HorizontalAlignment="Center" Margin="0,1,1,0" />
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Background" TargetName="PART_Border"
									Value="{DynamicResource ButtonMouseOverBackground}" />
							<Setter Property="BorderBrush" TargetName="PART_Border"
									Value="{DynamicResource ButtonMouseOverBorder}" />
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" TargetName="PART_Border"
									Value="{DynamicResource ButtonPressedBackground}" />
							<Setter Property="BorderBrush" TargetName="PART_Border"
									Value="{DynamicResource ButtonPressedBorder}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="{x:Type DatePicker}">
		<Setter Property="Background" Value="Transparent" />
		<Setter Property="Foreground" Value="#FF333333" />
		<Setter Property="IsTodayHighlighted" Value="True" />
		<Setter Property="SelectedDateFormat" Value="Short" />
		<Setter Property="Padding" Value="2" />
		<Setter Property="BorderThickness" Value="1" />
		<Setter Property="HorizontalContentAlignment" Value="Stretch" />
		<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" />
		<Setter Property="Height" Value="23" />
		<Setter Property="Padding" Value="0" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type DatePicker}">
					<Border BorderThickness="1" Padding="{TemplateBinding Padding}" BorderBrush="#FFBBBBBB">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="Disabled">
									<Storyboard>
										<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
												Storyboard.TargetName="PART_DisabledVisual" />
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid x:Name="PART_Root">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>
							<Button x:Name="PART_Button" Grid.Column="1" Focusable="False" HorizontalAlignment="Left"
									Grid.Row="0" Style="{StaticResource DropDownButtonStyle}" />
							<DatePickerTextBox x:Name="PART_TextBox" Grid.Column="0"
									Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}"
									Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="Stretch"
									Grid.Row="0" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch"
									HorizontalAlignment="Stretch" Margin="0">
								<DatePickerTextBox.ContextMenu>
									<ContextMenu>
										<MenuItem Header="Cu_t" Command="ApplicationCommands.Cut"
												InputGestureText="Ctrl+X">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/cut.png" />
											</MenuItem.Icon>
										</MenuItem>
										<MenuItem Header="_Copy" Command="ApplicationCommands.Copy"
												InputGestureText="Ctrl+C">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/copy.png" />
											</MenuItem.Icon>
										</MenuItem>
										<MenuItem Header="_Paste" Command="ApplicationCommands.Paste"
												InputGestureText="Ctrl+V">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/paste_sml.png" />
											</MenuItem.Icon>
										</MenuItem>
										<Separator />
										<MenuItem Header="_Undo" Command="ApplicationCommands.Undo"
												InputGestureText="Ctrl+Z">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/undo.png" />
											</MenuItem.Icon>
										</MenuItem>
										<MenuItem Header="_Redo" Command="ApplicationCommands.Redo"
												InputGestureText="Ctrl+Y">
											<MenuItem.Icon>
												<Image
														Source="pack://application:,,,/Daytimer.Images;component/Images/redo.png" />
											</MenuItem.Icon>
										</MenuItem>
									</ContextMenu>
								</DatePickerTextBox.ContextMenu>
								<DatePickerTextBox.Template>
									<ControlTemplate TargetType="{x:Type DatePickerTextBox}">
										<Grid>
											<VisualStateManager.VisualStateGroups>
												<VisualStateGroup x:Name="WatermarkStates">
													<VisualStateGroup.Transitions>
														<VisualTransition From="{x:Null}" GeneratedDuration="0"
																GeneratedEasingFunction="{x:Null}" Storyboard="{x:Null}"
																To="{x:Null}" />
													</VisualStateGroup.Transitions>
													<VisualState x:Name="Unwatermarked" />
													<VisualState x:Name="Watermarked">
														<Storyboard>
															<DoubleAnimation Duration="0" To="1"
																	Storyboard.TargetProperty="Opacity"
																	Storyboard.TargetName="PART_Watermark" />
														</Storyboard>
													</VisualState>
												</VisualStateGroup>
											</VisualStateManager.VisualStateGroups>
											<Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}"
													BorderThickness="{TemplateBinding BorderThickness}"
													Background="{TemplateBinding Background}" Opacity="1"
													Padding="{TemplateBinding Padding}">
												<Grid x:Name="WatermarkContent"
														HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
														VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
													<ContentControl x:Name="PART_Watermark" Focusable="False"
															IsHitTestVisible="False" Opacity="0" Foreground="#FF888888"
															VerticalAlignment="Center" Margin="3,0,0,0" />
													<ScrollViewer x:Name="PART_ContentHost" Margin="1,0,0,0"
															HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
															VerticalContentAlignment="Center" VerticalAlignment="Center" />
												</Grid>
											</Border>
										</Grid>
									</ControlTemplate>
								</DatePickerTextBox.Template>
							</DatePickerTextBox>
							<Grid x:Name="PART_DisabledVisual" Grid.ColumnSpan="2" Grid.Column="0"
									IsHitTestVisible="False" Opacity="0" Grid.Row="0">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<Rectangle Grid.Column="0" Fill="#A5FFFFFF" Grid.Row="0" />
								<Rectangle Grid.Column="1" Fill="#A5FFFFFF" Height="18" Margin="3,0,3,0" Grid.Row="0"
										Width="19" />
								<Popup x:Name="PART_Popup" Placement="Bottom" AllowsTransparency="True"
										PopupAnimation="Fade" PlacementTarget="{Binding ElementName=PART_TextBox}"
										StaysOpen="False" />
							</Grid>
						</Grid>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>